<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

require './fpdf.php';
require './class.SQLConfig.php';

$Conn = new SQLConfig();

$Conn->Query ="select tbl_Produkte.Name from tbl_Katalog_Produkte, tbl_Produkte where KatalogID = '9' and tbl_Katalog_Produkte.ProduktID = tbl_Produkte.ID";

$erg = $Conn->Get_Array();

//PDF Erzeugung
    class PDF extends FPDF
    {
    // Page footer
    function Footer()
    {
        // Position at 1.5 cm from bottom
        $this->SetY(-15);
        // Arial italic 8
        $this->SetFont('Arial','I',8);
        // Page number
        $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
    }
    }

    // Instanciation of inherited class
    $pdf = new PDF();
    $pdf->AliasNbPages();
    $pdf->AddPage(P,A4);
    $pdf->SetFont('Times','',34);
    $pdf->Cell(0,10,  utf8_decode(Übersicht),0,1,'C');
    $pdf->SetFont('Times','',12);
    $pdf->Cell(0,10,'Dieser Katalog enth'.utf8_decode(ä).'lt folgende Produkte:',0,1);
    
    $i=1;
     while ($row = sqlsrv_fetch_array($erg)){
        $pdf->Cell(0,10,'Produktname:  '.$row['Name'],0,1);
        $i++;
     }
     
     
     $Conn->Query ="select tbl_Produkte.Name, tbl_Produkte.beschreibung, tbl_Produkte.spezi from tbl_Katalog_Produkte, tbl_Produkte where KatalogID = '9' and tbl_Katalog_Produkte.ProduktID = tbl_Produkte.ID";
     $erg = $Conn->Get_Array();
     
     $j=1;
     while ($row = sqlsrv_fetch_array($erg)){
        $pdf->AddPage();
        $pdf->Image('../templates/fruehling_BG.png',0,0,220,300);
        $pdf->Cell(0,10,'Produkt:  '.$row['Name'],0,1);
        $pdf->Cell(0,10,'Beschreibung:  '.$row['beschreibung'],0,1);
        $pdf->Cell(0,10,'Spezifikation:  '.$row['spezi'],0,1);
        $pdf->Cell(0,10,'Bild: ',0,1);
        //$pdf->Image();        //Hier muss dann das Bild hin!
     
        $j++;
     }
     
    $pdf->Output();

?>
